<?php
namespace app\system\model;
use think\Model;

/**
 * 文章模型
 *
 * @ author zy <741599086@qq.com>
 * */

class NewsModel extends Model {

    protected $table = '__NEWS__';
	//开启自动完成字段
//	protected $autoWriteTimestamp = true;
	//新增时候字段的名称  自动将时间戳转为日期格式
//	protected $createTime = 'time';
	//关闭更新字段
//	protected $updateTime = false;

    /**
     * @param array $where
     * @param bool $pageSize
     * @param string $order
     * @return false|\PDOStatement|string|\think\Collection|\think\Paginator
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
	public function selectNews(array $where=[], $pageSize=false, $order='id desc')
	{
		$this->where($where)->order($order);
		if ($pageSize) {
			$result = $this->paginate($pageSize);
		} else {
			$result = $this->select();
		}
		return $result;
	}
}